<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="item in cars" @click="changeType">
                {{item.type}}
                <ul>
                    <li v-for="li in item.children">{{li}}</li>
                </ul>
            </li>
        </ul>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                cars: [
                    {
                        type: '宝马',
                        children: ['宝马325', '宝马525', '宝马730']
                    },
                    {
                        type: '奔驰',
                        children: ['奔驰c200', '奔驰E300', '奔驰S400']
                    }
                ]
            },
            /*
                'push',
                'pop',
                'shift',
                'unshift',
                'splice',
                'sort',
                'reverse'
            */
            methods: {
                changeType() {
                    this.cars[0].children[0] = '宝马x1'
                    
                    this.$set(this.cars[0], this.cars[0].children[0], '宝马x1')
                    // console.log(this.cars[0].children[0])
                }
            }
        })
    </script>
</body>
</html>